package cl.whyem.testsutilityproject.wizardGUI;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class WizardGUI extends JFrame implements ActionListener {

    private JLabel enterName;
    private JTextField name;
    private JButton prev, fow;
    private String storeName = "";

    public WizardGUI() {
        super("Wizard");
        JPanel mainPanel = new JPanel();
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(new FlowLayout());
        this.getContentPane().add(new JLabel("lol"));
        
        prev = new JButton("<--");
        fow = new JButton("-->");

        this.add(mainPanel);
        enterName = new JLabel("Enter Your Name: ");
        name = new JTextField(10);
        enterName.setBounds(60, 30, 120, 30);
        name.setBounds(80, 60, 130, 30);
        this.setSize(300, 390); //set frame size
        this.setVisible(true);
        this.getContentPane().add(enterName);
        this.getContentPane().add(name);
        this.getContentPane().add(prev);
        this.getContentPane().add(fow);
        fow.addActionListener(this);
    }

    void sScreen() {
        this.getContentPane().removeAll();
        this.validate();
        this.repaint();
        JPanel panel2 = new JPanel(new BorderLayout());
        this.add(panel2);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource().equals(fow)) {
            storeName = name.getText();
            System.out.println("Name entered: " + storeName);
            sScreen();
        }


    }
}